define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'user.bucket/index',
        add_url: 'user.bucket/add',
        edit_url: 'user.bucket/edit',
        delete_url: 'user.bucket/delete',
        export_url: 'user.bucket/export',
        modify_url: 'user.bucket/modify',
        viewuser_url: 'user.bucket/viewuser',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar:['refresh'],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: '分仓起始用户'},
                    {field: 'bucket_name', title: '分仓名称'},
                    // {field: 'admin_uid', title: '管理员id'},
                    // {field: 'members', title: '成员'},
                    // {field: 'create_time', title: 'create_time'},
                    // {field: 'bucket_id', title: '分仓id'},
                    {
                        width: 250,
                        title: '操作',
                         //templet: ea.table.tool, // 此为官方文档提供示例 
                          
                         templet: function (row) {
                            return ea.table.tool(row, {
                                init, // 初始化的数据变量
                                operat: [
                                    [{
                                        text: '查看成员',
                                        url: init.viewuser_url,
                                        method: 'open',
                                        auth: 'viewuser',
                                        class: 'layui-btn layui-btn-xs layui-btn-success',
                                        extend: 'data-full="true"',
                                    },],
                                    'delete']
                            })
                         },
                        
                     }
                   
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});